home *** CD-ROM | disk | FTP | other *** search
-
-
-
- PROGRAM TIMERS
-
-
- Some time ago a program of mine had a bad habit of taking fifty times
- longer to run than it should have done. None of the profilers that I
- could find worked well enough to tell me what was going on so the first
- CTimer was written (and published in the excellent Australian DiskMag
- MegaDisk). This was when I first found that there seemed to be no way of
- reading a time value (as opposed to counting down a time interval) to better
- than 20 milliseconds, although the Amiga's trick of adding one to the micro
- -seconds figure each time the clock was accessed within a 20-millisecond
- period made it appear as though genuine microseconds were being produced.
- However Ctimer's 20-millisecond resolution was quite good enough provided
- that short sections of code were run often enough to give an average figure.
- My difficulties were successfully traced to a single line of innocent-looking
- code that an early version of the V2 operating system took exception to.
-
- Recently a too-sluggish programme re-aroused interest and CTimer1 was
- born. This read the horizontal and vertical beam position on entry and exit
- from a code section and converted the difference to a time interval. Direct
- access to the beam counter gave very fast response and minimum dead time,
- with a basic resolution of about 300 nanoseconds. One problem met was that
- the beam counters had a number of highly idiosyncratic ways of counting.Some
- distinctly dubious fudge factors had to be used to make the results
- meaningful, and hence there must be doubts about accuracy.
-
- The new V2.0 function ReadEClock offered new possibilities, since this
- returns a figure which can be converted to genuine microseconds. This is
- used by CTimer2. The ReadEClock function is fairly slow and dead time is
- high; resolution is also not (theoretically) as good as CTimer1, but no
- fudges are needed and CTimer2 should be a lot more accurate and reliable.
-
-
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-